#include <iostream>
#include <chrono>
#include <vector>
#include <string>
#include "ku.h"
#include "guass_newton.h"

int main (int argc, char **argv)
{
    std::vector<double> t_1,x_1,y_1;
    std::vector<double> t_2,x_2,y_2;
    std::vector<double> Ey,Ex;
    int num_1,num_2;
    std::string name_1 = "typhoon";
    std::string name_2 = "predict";
    read_file(t_1,x_1,y_1,name_1,&num_1);     
    read_file(t_2,x_2,y_2,name_2,&num_2);
    double a_1,b_1,c_1;
    guass_newtown_3d(t_1,y_1,&num_1,&a_1,&b_1,&c_1);
    double a_2,c_2,r_2;
    double temp_x=0,temp_y=0;
    guass_newtown_2d(t_1,x_1,&num_1,&a_2,&c_2,&r_2);
    double t = initime(91212)-initime(90500);
    for(int i=0;i<num_2;i++){
        double ti = t_2[i];
        double xi = x_2[i];
        double yi = y_2[i];
        temp_x =funcx(a_2,c_2,r_2,ti,t);
        temp_y=funcy(a_1,b_1,c_1,ti);
        //std::cout<<temp_x<<endl;
        Ey.push_back(temp_y);
        Ex.push_back(temp_x);
    }
    variance(Ey,y_2,&num_2);
    variance(Ex,x_2,&num_2);
    return 0;
}